package com.gan.simple_init.controller.sys;

import com.gan.simple_init.common.constant.UserConstant;
import com.gan.simple_init.common.base.ResponseResult;
import com.gan.simple_init.common.base.RestResultGenerator;
import com.gan.simple_init.model.sys.dto.SysOperationLogDTO;
import com.gan.simple_init.service.SysOperationLogService;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author gbw
 * @date 2023/8/17
 */
@RestController
@RequestMapping("/operlog")
public class SysOperationLogController {

    @Resource
    SysOperationLogService sysOperationLogService;

    @PreAuthorize(UserConstant.PRE_ROLE_NAME_ADMIN)
    @ApiOperation("条件查询操作日志")
    @PostMapping("/list")
    public ResponseResult<?> listOperLogByPage(@RequestBody SysOperationLogDTO sysOperationLogDTO){
        return RestResultGenerator.success(sysOperationLogService.listOperLogByPage(sysOperationLogDTO));
    }

}
